<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="../common/js.jsp" %>
<%@include file="../common/jspcommon.jsp" %>
<%@include file="../common/css.jsp" %>
<title>头像修改 - 爽客网</title>
<script type="text/javascript">

		function avatarUploadImg(){
			var filepath=$("#uploadAvatar").val(); 
			var extStart=filepath.lastIndexOf("."); 
			var ext=filepath.substring(extStart,filepath.length).toUpperCase(); 
			if(ext!=".PNG"&&ext!=".JPG"&&ext!=".JPEG"&&ext!=".GIF"){ 
				alert("图片限于png,jpeg,jpg,gif格式"); 
				return ; 
			}
			$("#upload_avatar_form").ajaxSubmit({
				dataType : 'json',
				cache : false,
				success : function(data) {
					$("#image_server").val(data.imageServer);
					$("#avatarImage").val(data.imageUrl);
					$("#image").html("<img  width='120px'  src='"+data.imageServer+data.imageUrl+"'>"); 
					 if(data.imageUrl!=""){
						 alert("上传图片成功");
					}else{
						alert("上传图片失败");
					}
				},
				error : function(err) {
					alert(err);
				}
			});
			return false;
		}
</script>


  <!-- avater -->
                     
                        	<div class="i_avater_wrap clearfix">
                            	<div class="ava_left">
                                	<h2>当前头像</h2>
                                	<div id="image">
                                		<img alt="头像" src="${member.imageServer}${member.avatar}">
                                	</div>
                                    
                                </div>
                                <div class="ava_right">
                                	<h2>选择从您电脑中上传图片作为头像</h2>
                                    <span>请选择新的照片文件，文件需小于500KB</span>
                                    <form id="upload_avatar_form" enctype="multipart/form-data" method="post" action="uploadAvaImg.htm">
											<input type="file" value="选择文件" class="i_up" id="uploadAvatar" name="uploadAvatar" onchange="avatarUploadImg();return false;"/>
									</form>
                                    
                                </div>
                            </div>
                       
                        <!-- avater--end -->


